package com.yunhai.xc.common.ftp;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.yunhai.xc.common.UploadUtil;

@Component
@RequestMapping("/common")
public class UploadController {
	@PostMapping(value = "/uploadFile")
	@ResponseBody
	public Map<String, Object> upload(@RequestParam("image") MultipartFile[] files) throws Exception {
		String uploadFilePath = null;
		for (MultipartFile file : files) {
			uploadFilePath = UploadUtil.uploadFile(file);
		}
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("path", uploadFilePath);
		return map;
	}

}
